import request from "@/utils/request";
import { IndexTypeQuery, IndexTypePageResult, IndexTypeForm, IndexType } from "./model";

/**
 * 首页板块API
 */
class IndexTypeAPI {

  /**
   * 板块内容分类分页数据
   * @param queryParams 
   * @returns 
   */
  static getPage(queryParams?: IndexTypeQuery) {
    return request<any, IndexTypePageResult>({
      url:
        "/indexType/getPage?currentPage=" +
        queryParams?.pageNum +
        "&size=" +
        queryParams?.pageSize,
      method: "post",
      data: queryParams,
    });
  }

  /**
   * 获取首页板块列表
   * @param data 
   * @returns 
   */
  static getList(data: IndexTypeQuery) {
    return request<any, IndexType[]>({
      url: "/indexType/getList",
      method: "post",
      data: data,
    });
  }


  /**
   * 新增首页板块
   * @param data 
   * @returns 
   */
  static add(data: IndexTypeForm) {
    return request({
      url: "/indexType/add",
      method: "post",
      data: data,
    });
  }
  /**
   * 修改首页板块
   * @param data 
   * @returns 
   */
  static update(data: IndexTypeForm) {
    return request({
      url: "/indexType/edit",
      method: "post",
      data: data,
    });
  }

  /**
   * 删除首页板块
   * @param data 
   * @returns 
   */
  static delete(data: IndexTypeForm) {
    return request({
      url: "/indexType/delete",
      method: "post",
      data: data,
    });
  }
}

export default IndexTypeAPI;
